-- This script was generated by the Schema Diff utility in pgAdmin 4
-- For the circular dependencies, the order in which Schema Diff writes the objects is not very sophisticated
-- and may require manual changes to the script to ensure changes are applied in the correct order.
-- Please report an issue for any failure with the reproduction steps.
DROP VIEW public.metrics;

 CREATE OR REPLACE VIEW public.metrics
  AS
  SELECT
     ( SELECT avg(EXTRACT(epoch FROM response.created_at - request.created_at)) AS avg
            FROM request
              LEFT JOIN response ON response.request = request.id) AS average_response_time,
     ( SELECT avg((((response.body ->> 'usage'::text)::json) ->> 'total_tokens'::text)::integer) AS 
 avg
            FROM response) AS average_tokens_per_response;